<!DOCTYPE html>
<html>

<head>
    <title>{{ get_ctf_name() }}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="{{ url_for('views.themes', path='img/favicon.ico') }}" type="image/x-icon">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/vendor/uikit.css') }}">
    <!--<link rel="stylesheet" href="{{ url_for('views.themes', path='css/vendor/font-awesome/fontawesome-fonts.css') }}" type='text/css'>
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/vendor/font-awesome/fontawesome-all.min.css') }}" type='text/css'>
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/vendor/font.css') }}" type='text/css'>-->
    <!-- <link rel="stylesheet" href="{{ url_for('views.themes', path='css/jumbotron.css') }}"> -->
    <!-- <link rel="stylesheet" href="{{ url_for('views.themes', path='css/sticky-footer.css') }}">  -->
    <!-- <link rel="stylesheet" href="{{ url_for('views.themes', path='css/base.css') }}"> -->
    {% block stylesheets %}{% endblock %}
    {% for stylesheet in get_registered_stylesheets() %}
    {% if stylesheet.startswith('http') %}
    <link rel="stylesheet" type="text/css" href="{{ stylesheet }}">
    {% elif request.script_root %}
    <link rel="stylesheet" type="text/css" href="{{ request.script_root }}/{{ stylesheet }}">
    {% else %}
    <link rel="stylesheet" type="text/css" href="{{ stylesheet }}">
    {% endif %}
    {% endfor %}
    <link rel="stylesheet" type="text/css" href="{{ url_for('views.custom_css') }}">
    <script src="{{ url_for('views.themes', path='js/vendor/promise-polyfill.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/eventsource.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/fetch.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/CTFd.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/moment.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/nunjucks.min.js') }}"></script>
    <script type="text/javascript">
    var script_root = "{{ request.script_root }}";
    var csrf_nonce = "{{ nonce }}";
    var user_mode = "{{ get_config('user_mode') }}";
    var ctf_start = {{ get_config("start") | tojson }};
    var ctf_end = {{ get_config("end") | tojson }};
    CTFd.options.urlRoot = script_root;
    CTFd.options.csrfNonce = csrf_nonce;
    CTFd.options.start = ctf_start;
    CTFd.options.end = ctf_end;
    </script>
</head>

<body>
    <div class="tm-header-mobile uk-hidden@m">
        <nav class="uk-navbar-container" uk-navbar>
            <div class="uk-navbar-left">
                <a class="uk-navbar-toggle" href="#tm-mobile" uk-toggle>
                    <div uk-navbar-toggle-icon></div>
                    <span class="uk-margin-small-left">Menu</span>
                </a>
            </div>
            <div class="uk-navbar-center">
                <a class="uk-navbar-item uk-logo" href="{{ request.script_root }}/">
                    {% if get_ctf_logo() %}
                    <img data-src="{{ request.script_root }}/files/{{ get_ctf_logo() }}" width="100" alt="{{ get_ctf_name() }}" uk-img>
                    {% else %}
                    {{ get_ctf_name() }}
                    {% endif %}</a>
            </div>
        </nav>
        <div id="tm-mobile" class="uk-modal-full" uk-modal>
            <div class="uk-modal-dialog uk-background-muted uk-modal-body uk-text-center uk-height-viewport">
                <button class="uk-modal-close-full" type="button" uk-close></button>
                <div class="uk-child-width-1-1" uk-grid>
                    <div>
                        <div class="uk-panel" id="module-0">
                            <ul class="uk-nav uk-nav-default uk-nav-center">
                                {% for page in get_user_page_menu_bar() %}
                                {% if page.route.startswith('http://') or page.route.startswith('https://') %}
                                <li>
                                    <a href="{{ page.route }}">{{ page.title }}</a>
                                </li>
                                {% else %}
                                <li>
                                    <a href="{{ url_for('views.static_html', route=page.route) }}">{{ page.title }}</a>
                                </li>
                                {% endif %}
                                {% endfor %}
                                <li>
                                    <a href="{{ url_for('views.notifications') }}">Notifications</a>
                                </li>
                                {% if get_config('account_visibility') != 'admins' %}
                                <li>
                                    <a href="{{ url_for('users.listing') }}">Users</a>
                                </li>
                                {% if get_config('user_mode') == 'teams' %}
                                <li>
                                    <a href="{{ url_for('teams.listing') }}">Teams</a>
                                </li>
                                {% endif %}
                                {% endif %}
                                {% if get_config('score_visibility') != 'admins' %}
                                <li>
                                    <a href="{{ url_for('scoreboard.listing') }}">Scoreboard</a>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('challenges.listing') }}">Challenges</a>
                                </li>
                                {% if name is defined %}
                                {% if type == 'admin' %}
                                <li>
                                    <a href="{{ url_for('admin.view') }}">Admin</a>
                                </li>
                                {% endif %}
                                {% if config.user_mode() == "teams" %}
                                <li>
                                    <a href="{{ url_for('teams.private') }}">Team</a>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('users.private') }}">Profile</a>
                                </li>
                                <li>
                                    <a href="{{ url_for('views.settings') }}">Settings</a>
                                </li>
                                <li>
                                    <a href="{{ url_for('auth.logout') }}">Logout</a>
                                </li>
                                {% else %}
                                {% if registration_visible() %}
                                <li>
                                    <a href="{{ url_for('auth.register') }}">Register</a>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('auth.login') }}">Login</a>
                                </li>
                                {% endif %}
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="tm-header uk-visible@m" uk-header>
        <div uk-sticky="show-on-up: true; top: 200; animation: uk-animation-fade;sel-target: .uk-navbar-container; cls-active: .uk-navbar-sticky;cls-inactive: .uk-light;">
            <div class='uk-background-primary uk-preserve-color uk-dark'>
                <div class="uk-container">
                    <nav class="uk-navbar-container uk-navbar-transparent" uk-navbar>
                        <div class="uk-navbar-left">
                            <a href="{{ url_for('views.static_html', route='/') }}" class="uk-navbar-item uk-logo">
                                {% if get_ctf_logo() %}
                                <img src="{{ url_for('views.files', path=get_ctf_logo()) }}" width="75" alt="{{ get_ctf_name() }}" uk-img>
                                {% else %}
                                {{ get_ctf_name() }}
                                {% endif %}
                            </a>
                            <ul class="uk-navbar-nav">
                                {% for page in get_user_page_menu_bar() %}
                                {% if page.route.startswith('http://') or page.route.startswith('https://') %}
                                <li>
                                    <a href="{{ page.route }}">{{ page.title }}</a>
                                </li>
                                {% else %}
                                <li>
                                    <a href="{{ url_for('views.static_html', route=page.route) }}">{{ page.title }}</a>
                                </li>
                                {% endif %}
                                {% endfor %}
                                <li>
                                    <a href="{{ url_for('views.notifications') }}">Notifications</a>
                                </li>
                                {% if get_config('account_visibility') != 'admins' %}
                                <li>
                                    <a href="{{ url_for('users.listing') }}">Users</a>
                                </li>
                                {% if get_config('user_mode') == 'teams' %}
                                <li>
                                    <a href="{{ url_for('teams.listing') }}">Teams</a>
                                </li>
                                {% endif %}
                                {% endif %}
                                {% if get_config('score_visibility') != 'admins' %}
                                <li>
                                    <a href="{{ url_for('scoreboard.listing') }}">Scoreboard</a>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('challenges.listing') }}">Challenges</a>
                                </li>
                            </ul>
                        </div>
                        <div class="uk-navbar-right">
                            <ul class="uk-navbar-nav">
                                {% if name is defined %}
                                {% if type == 'admin' %}
                                <li>
                                    <a href="{{ url_for('admin.view') }}">Admin</a>
                                </li>
                                {% endif %}
                                {% if config.user_mode() == "teams" %}
                                <li>
                                    <a href="{{ url_for('teams.private') }}">Team</a>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('users.private') }}">Profile</a>
                                </li>
                                <li>
                                    <a href="{{ url_for('views.settings') }}">Settings</a>
                                </li>
                                <li>
                                    <a href="{{ url_for('auth.logout') }}">Logout</a>
                                </li>
                                {% else %}
                                {% if registration_visible() %}
                                <li>
                                    <a href="{{ url_for('auth.register') }}">Register</a>
                                </li>
                                <li>
                                    <div class="uk-navbar-item">
                                        <div>|</div>
                                    </div>
                                </li>
                                {% endif %}
                                <li>
                                    <a href="{{ url_for('auth.login') }}">Login</a>
                                </li>
                                {% endif %}
                            </ul>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <main role="main">
        {% block content %}
        {% endblock %}
    </main>
    <footer>
        <div class="uk-section uk-section-muted uk-preserve-color">
            <div class="uk-container uk-container-medium uk-text-center">
                <p class="uk-text-muted uk-text-small">Powered by <a target='_blank' href="https://ctfd.io">CTFd</a></p>
                <p class="uk-text-muted uk-text-small">StormCTF theme by <a target='_blank' href="https://twitter.com/offsec_ginger">Stitch</a></p>
                <a href="#" uk-totop uk-scroll></a>
            </div>
        </div>
    </footer>
    <script src="{{ url_for('views.themes', path='js/vendor/jquery.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/markdown-it.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/uikit.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/uikit-icons.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/howler.min.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/vendor/window-controller.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/style.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/utils.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/ezq.js') }}"></script>
    <script src="{{ url_for('views.themes', path='js/events.js') }}"></script>
    {% block scripts %}
    {% endblock %}
    {% for script in get_registered_scripts() %}
    {% if script.startswith('http') %}
    <script src="{{ script }}"></script>
    {% elif request.script_root %}
    <script src="{{ request.script_root }}/{{ script }}"></script>
    {% else %}
    <script src="{{ script }}"></script>
    {% endif %}
    {% endfor %}
</body>

</html>